Rails.application.routes.draw do
  apipie
  # For details on the DSL available within this file, see http://guides.rubyonrails.org/routing.html
  namespace :api do
    namespace :v1 do
      post '/login', to: 'authentications#authenticate_user'
      get '/current_user', to: 'users#show'
      #发送用户激活邮件
      post '/activity', to:'users#activity'

      concern :batch_op do
        collection do
          post 'batch_create'
          delete 'batch_delete'
          patch 'batch_update'
        end
      end

      resources :users, only: [:index, :create, :show, :update, :destroy]

      resources :user_logs, only: [:index, :create]
      resources :reset_password, only: [:show, :update]

      resources :companies, only: [:index, :create, :show, :update]

      resources :roles, only: [:index, :create]

      resources :user_logs, only: [:index, :create, :show]

      resources :locations, only: [:index, :create, :show, :update, :destroy]
      resources :video_sources, only: [:index, :create, :show, :update, :destroy]

      resources :beehives, concerns: :batch_op, only: [:index, :create, :show, :update, :destroy]
      resources :bee_frames, concerns: :batch_op, only: [:index, :create, :show, :update, :destroy]
      resources :bee_categories, only: [:index, :create]
      resources :plants, only: [:index, :create] 
      resources :bee_processes, concerns: :batch_op, only: [:index, :create, :show, :update, :destroy]
      resources :bee_medicines, only: [:index, :create]
      resources :bee_actions, only: [:index, :create]
      resources :product_informations, only: [:index, :create, :show, :update, :destroy]
      resources :brands, only: [:index, :create, :show, :update, :destroy]
      resources :product_results, only: [:index]

      resources :product_processes, only: [:index, :create] do
        post 'batch_create', on: :collection
      end

      resources :product_actions, only: [:index, :create]
      resources :product_expresses, only: [:index, :create, :show, :update, :destroy] do
        post 'batch_create', on: :collection
      end

      resources :express_companies, only: [:index, :create, :show, :update, :destroy]

      resources :certifications, only: [:index, :create, :show, :update, :destroy]

      resources :picutres, only: [:index, :create, :show, :update, :destroy] do
        post 'batch_create', on: :collection
      end

      resources :secret_pictures, only: [:index, :create, :show, :update, :destroy] do
        post 'batach_create', on: :collection
      end

      resources :picture_categories, only: [:index, :create]
      resources :secret_picture_categories, only: [:index, :create]
    end
  end
end
